﻿using ET.Monitor.DAL;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ET.Monitor.Model
{
    public class PointModel
    {
        string point = "";
        string[] points = null;
        DateTime st = new DateTime();
        DateTime et = new DateTime();
        int second = 0;
        PointDAL dal = new PointDAL();

        public PointModel(string pt)
        {
            point = pt;
        }

        public PointModel(string pt, DateTime sTime, DateTime eTime)
        {
            point = pt;
            st = sTime;
            et = eTime;
        }

        public PointModel(string[] pt, DateTime sTime, DateTime eTime)
        {
            points = pt;
            st = sTime;
            et = eTime;
        }

        public PointModel(string pt, DateTime sTime, DateTime eTime, int seconds)
        {
            point = pt;
            st = sTime;
            et = eTime;
            second = seconds;
        }

        public PointModel(string[] pt, DateTime sTime, DateTime eTime, int seconds)
        {
            points = pt;
            st = sTime;
            et = eTime;
            second = seconds;
        }
        public PointModel(string[] pts) { points = pts; }

        #region 获取测点实时值
        object realVal;

        public object RealVal
        {
            get { return dal.GetRealVal(point); }
            set { realVal = value; }
        }

        public object RealValArray
        {
            get { return dal.GetRealVals(points); }
            set { realVal = value; }
        }
        #endregion

        public double[] PointVals
        {
            get
            {
                return dal.GetPointVals(point, st, et);
            }

            set
            {
                pointVals = value;
            }
        }
        double[] pointVals;

        public IList<Hashtable> PointValsTimeAndSecond
        {
            get
            {
                return dal.GetPointVals(point, st, et, second);
            }

            set
            {
                pointValsTimeAndSecond = value;
            }
        }
        IList<Hashtable> pointValsTimeAndSecond;

        public IList<Hashtable> PointValsTime
        {
            get
            {
                return dal.GetPointVals(points, st, et);
            }

            set
            {
                pointValsTime = value;
            }
        }
        IList<Hashtable> pointValsTime;

        public IList<Hashtable> PointValTimeAndSecond
        {
            get
            {
                return dal.GetPointVals(points, st, et, second);
            }

            set
            {
                pointValTimeAndSecond = value;
            }
        }
        IList<Hashtable> pointValTimeAndSecond;

    }
}
